<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    先变量声明提升，
    再函数整个提升（相当于剪切）优于变量提升
    变量赋值不提升
    <script>
        (function () {

            console.log(1,a)

            var a = 5;

            function a() { console.log('i am a');}

            console.log(2,a)

            function b() {}

            b = 6

            console.log(3,b)

            var c = d = b

        })()

        console.log(4,d)

        console.log(5,c)
//解析后的代码
        // (
        //     function(){
        //         function a() { console.log('i am a');}
        //         function b() {}
        //         var a
        //         var c
        //         console.log(1,a)
        //         a = 5;
        //         console.log(2,a)
        //         b = 6
        //         console.log(3,b)
        //         c = d = b //window.d = b
        //     }
        // )()
        // console.log(4,d)
        // console.log(5,c)
        // 1,undefined
        // 2,5
        // 3,6
        // 4,6
        // 5,undefined
    </script>
</body>

</html>